# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

# Initial PKGBUILD from AUR.
# Old HackTV git version
# Old Maintainer: cropinghigh <joinmark60@gmail.com>
# Old Author: fsphil

pkgname=hacktv
pkgver=542.acb1181
pkgrel=2
pkgdesc='Analogue TV transmitter for the HackRF.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-radio')
license=('GPL3')
depends=('hackrf' 'ffmpeg' 'soapysdr')
makedepends=('git')
source=("git+https://github.com/fsphil/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd $pkgname

  make -C src/
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/local"

  ln -s "$pkgdir/usr/bin" "$pkgdir/usr/local/bin"
  make -C src/ PREFIX="$pkgdir" install
  rm -r "$pkgdir/usr/local"
}

